/*
 * Copyright (c) 2009, Jan Pastor. All Rights Reserved.
 */

package sk.jp.jitag.dao.db4o.model;

import sk.jp.jitag.dao.db4o.Column;
import sk.jp.jitag.dao.db4o.BaseEntity;

public class Address extends BaseEntity {

    public static final int STREET_MAXLEN = 256;
    public static final int CITY_MAXLEN = 256;

    private static final Column _STREET = new Column("street");
    private static final Column _CITY = new Column("street");

    private String street;
    private String city;

    //----------------------------------------------------------------------

    public Address(String street, String city) {
        checkNotNullNotEmpty(_STREET, street);
        checkMaxLen(_STREET, street, STREET_MAXLEN);
        checkNotNullNotEmpty(_CITY, city);
        checkMaxLen(_CITY, city, CITY_MAXLEN);

        this.street = street;
        this.city = city;
    }

    public String getStreet() {
        return street;
    }

    public String getCity() {
        return city;
    }

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder();
        sb.append("Address");
        sb.append("{street='").append(street).append('\'');
        sb.append(", city='").append(city).append('\'');
        sb.append('}');
        return sb.toString();
    }
}
